/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


package br.com.fiap.bean;


import javax.enterprise.context.SessionScoped;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.event.ComponentSystemEvent;

@ManagedBean(name = "bb")
@SessionScoped
/**
 *
 * @author rm62102
 */
public class BackBean {

    public void validarData(ComponentSystemEvent e){
        UIComponent source = e.getComponent();
        UIInput dayInput = (UIInput) source.findComponent("day");
        UIInput monthInput = (UIInput) source.findComponent("month");
        UIInput yeaInput = (UIInput) source.findComponent("year");
        int d = ((Integer) dayInput.getLocalValue()).intValue();
        int m = ((Integer)monthInput.getLocalValue()).intValue();
        int y = ((Integer)yeaInput.getLocalValue()).intValue();

    }

    public boolean dataValida(int dia, int mes, int ano){
        boolean v = false;
        if(ano>=0)
            if(mes == 1 || mes==3 || mes == 5 || mes == 8)
                if(dia<=31 || dia>=1)
                    v=true;
            
        return v;
    }
}
